package cate.common.table.pvp.minecraft.challenge_base;

import cate.common.table.EExcelNoteField;
import cate.common.table.EExcelRowClass;
import cate.common.table.ERow;
import cate.common.util.SplitParser;
import cate.common.util.random.RandomDropItem;
import easy.java.dev.note.NoteField;

import java.util.ArrayList;
import java.util.List;

@EExcelRowClass(note = "灵能矿场-灵能矿场本服 Row", IDTitle = "矿场等级")
public class MinecraftChallengeBaseRow extends ERow {
    @EExcelNoteField(fieldName = "升级消耗资源")
    public String levelUpCostStr;
    @EExcelNoteField(fieldName = "每分钟资源产出")
    public String hangResPerMinuteStr;
    @EExcelNoteField(fieldName = "挂机掉落")
    public String randomDropStr;
    @EExcelNoteField(fieldName = "挂机时长")
    public int maxHangMinute;

    @NoteField("随机掉落列表")
    public List<RandomDropItem> randomDropList = new ArrayList<>();

    @Override
    public void decode() {
        super.decode();
        randomDropList.clear();
        randomDropList = SplitParser.parse(RandomDropItem.class, randomDropStr);
        randomDropList.removeIf(item -> item.weight <= 0);
    }
}
